﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using BibMan.model;
using BibMan.gui;
using BibMan.model.database.Referencer;
using BibMan.model.database;
using System.Diagnostics;
using BibMan.model.database.bibtex;

namespace BibMan {
    static class Program {

        public static String filename = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)+"\\Documents\\Visual Studio Projects\\BibMan\\test.reflib.xml";

        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main() {
            //filename = "C:\\Users\\ptay89\\Dropbox\\Visual Studio Projects\\BibRef\\References.reflib";
            //Database db = new JabRefLoader(filename).Load().ToDatabase();
            //db.Pins["Autonomy"].Notes = "SOME NOTES HERE!!!LOLZ";
            //DatabaseLoader.Save(db, filename + ".xml");
            //DatabaseLoader.Load(filename + ".xml");

            //Database db = new DatabaseLoader(filename).Load();
            //Console.WriteLine(db.ToBibTex());

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Front());
        }

        public static TimeSpan MeasureExecTime(Action action, int iterations) {
            action(); // warm up
            var sw = Stopwatch.StartNew();
            for (int i = 0; i < iterations; i++) {
                action();
            }
            return sw.Elapsed;
        }
    }
}
